@model IEnumerable<ShivamEMR.Model.Domain.PersonDomain.Person>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>
<table>
    <tr>
        <th></th>
        <th>
            Code
        </th>
        <th>
            Title
        </th>
        <th>
            FirstName
        </th>
        <th>
            MiddleName
        </th>
        <th>
            LastName
        </th>
        <th>
            AltFirstName
        </th>
        <th>
            AltMiddleName
        </th>
        <th>
            AltLastName
        </th>
        <th>
            DateOfBirth
        </th>
        <th>
            Barcode
        </th>
        <th>
            MaritalSatusID
        </th>
        <th>
            Sex
        </th>
        <th>
            MaritalStatus
        </th>
        <th>
            Picture
        </th>
        <th>
            Addresses
        </th>
        <th>
            Contacts
        </th>
        <th>
            CitizenShips
        </th>
        <th>
            Informations
        </th>
        <th>
            Account
        </th>
        <th>
            PersonRoles
        </th>
        <th>
            PersonStatus
        </th>
        <th>
            Groups
        </th>
        <th>
            Documents
        </th>
        <th>
            Assignments
        </th>
        <th>
            InteractionsWith
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.ID }) |
            @Html.ActionLink("Details", "Details", new { id=item.ID }) |
            @Html.ActionLink("Delete", "Delete", new { id=item.ID })
        </td>
        <td>
			@item.Code
        </td>
        <td>
			@item.Title
        </td>
        <td>
			@item.FirstName
        </td>
        <td>
			@item.MiddleName
        </td>
        <td>
			@item.LastName
        </td>
        <td>
			@item.AltFirstName
        </td>
        <td>
			@item.AltMiddleName
        </td>
        <td>
			@item.AltLastName
        </td>
        <td>
			@String.Format("{0:g}", item.DateOfBirth)
        </td>
        <td>
			@item.Barcode
        </td>
        <td>
			@item.MaritalSatusID
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.Sex).ToString()
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.MaritalStatus).ToString()
        </td>
        <td>
			@(item.Picture == null ? "None" : item.Picture.Title)
        </td>
        <td>
			@(item.Addresses == null ? "None" : item.Addresses.Count.ToString())
        </td>
        <td>
			@(item.Contacts == null ? "None" : item.Contacts.Count.ToString())
        </td>
        <td>
			@(item.CitizenShips == null ? "None" : item.CitizenShips.Count.ToString())
        </td>
        <td>
			@(item.Informations == null ? "None" : item.Informations.Count.ToString())
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.Account).ToString()
        </td>
        <td>
			@(item.PersonRoles == null ? "None" : item.PersonRoles.Count.ToString())
        </td>
        <td>
			@Html.DisplayTextFor(_ => item.PersonStatus).ToString()
        </td>
        <td>
			@(item.Groups == null ? "None" : item.Groups.Count.ToString())
        </td>
        <td>
			@(item.Documents == null ? "None" : item.Documents.Count.ToString())
        </td>
        <td>
			@(item.Assignments == null ? "None" : item.Assignments.Count.ToString())
        </td>
        <td>
			@(item.InteractionsWith == null ? "None" : item.InteractionsWith.Count.ToString())
        </td>
    </tr>
}

</table>


